<%--
 *  File:    NotesInfo.jsp
 *  @Author: Vector mao 
 *  Date:    2/20/2002 13:56
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="java.net.*" %>
<%@ page import="org.apache.log4j.Category" %>


<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  	Category cat = Category.getInstance("jsp.NotesInfo"); 
  	//init param
  	String strModuleName = "BIEE";
    String strFileDir = ConstantProp.DEFAULT_IMG_SRC;
    String contextPath = request.getContextPath();
%>

<%
	String notesid = null;
  	boolean bIsNew = false;
  	
	notesid=request.getParameter("notesid");
	if (notesid==null)
	{
	notesid=session.getAttribute("notesid").toString();
	}
	
  	//notesid = pageContext.getAttribute("notesid").toString();
  	 
  	 //if(request.getParameter("notesid") == null)
  	if(notesid== null)
  	{
    	bIsNew = true;
  	}
%>
<%@ include file="/inc/PageDefault.inc" %>
<html>

<head>
<title>NotesInfo</title>
<PageFlow:CheckPageFlow pageName="publicationnotesinfo"/>


<%  
  	HashMap userInfo = (HashMap)session.getAttribute("userinfo");
  	if (userInfo==null)
  	  userInfo = new HashMap();
		Vector pictureinfo = (Vector)pageContext.getAttribute("pictureinfo");
	  if (pictureinfo == null)
	    pictureinfo = new Vector();


	HashMap myhash = null;
	if(!bIsNew)
	{
		myhash = (HashMap)pageContext.getAttribute("pubnotesinfo");
  }
    
  
  String status = null;
  String title = null;
  String content = null;
  String fromusername = null;
  String fromorgshortname=null;
  String begindate = null;
  String enddate = null;
  Vector oldpictures = new Vector();
  String ispublic = null;

	if(myhash == null)
	{
	  	myhash = new HashMap();
	}
	else
	{
		notesid = (myhash.get("notesid")).toString();
		
    title = (myhash.get("title")).toString();
    status = (myhash.get("status")==null ? "" : (myhash.get("status")).toString());
    fromusername = (myhash.get("fromusername")==null ? "" : (myhash.get("fromusername")).toString());
    fromorgshortname = (myhash.get("fromorgshortname")==null ? "" : (myhash.get("fromorgshortname")).toString());
    begindate = (myhash.get("begindate")==null ? "" : (myhash.get("begindate")).toString());
    enddate = (myhash.get("enddate")==null ? "" : (myhash.get("enddate")).toString());
    oldpictures = myhash.get("oldpictures")==null ? oldpictures : (Vector)(myhash.get("oldpictures"));
    ispublic = (myhash.get("ispublic") == null ? "" : (myhash.get("ispublic")).toString());
	}
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"> 
</script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"> 
</script>
<script>
function page_done()
{
    if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE_SUBMIT") %>") )  return;
  	document.publicationnotesinfoform.actionname.value = "submitnews";
	  if (self.name == "content")
	    publicationnotesinfoform.target = "_self"
	  else
	    publicationnotesinfoform.target = "_parent"
	  isRunning = true;
  	document.publicationnotesinfoform.submit();
}
</script>
<script>
function page_approval()
{
  publicationnotesinfoform.actionname.value = "approve";
  if (self.name == "content")
    publicationnotesinfoform.target = "_self"
  else
    publicationnotesinfoform.target = "_parent"
  isRunning = true;
  publicationnotesinfoform.submit();
}
function page_apprecord()
{
  publicationnotesinfoform.actionname.value = "approverecord";
  publicationnotesinfoform.target="_parent";
  isRunning = true;
  publicationnotesinfoform.submit();
}

function page_action(action)
{
  if (action=="deny" || action == "agree")
  {
      document.publicationnotesinfoform.pagename.value = "approvalnotesedit";
      if (action == "deny")
      {
         document.publicationnotesinfoform.actionname.value = "approvedenied";	document.publicationnotesinfoform.content0.value = "<%= label.getLabelName("L_Refuse",false)%>";
      }
      else if (action == "agree")
      { 
        document.publicationnotesinfoform.actionname.value = "approvepassed";
		document.publicationnotesinfoform.content0.value = "<%= label.getLabelName("L_Agree",false)%>";
      } 
      isRunning = true;
	  document.publicationnotesinfoform.content1.value = document.publicationnotesinfoform.content0.value;
      document.publicationnotesinfoform.content3.value = document.publicationnotesinfoform.content2.value;
	  document.publicationnotesinfoform.target = "_parent"
      document.publicationnotesinfoform.submit();
      return;
  } 
}

function page_back(){
	var link = "Blank.jsp?<%= OvalTools.randomURL() %>";
	window.open(link,"_self");
}

</script>

</head>
<body>

	<%--------------------------------------  hidden form variant   --%>
	<form name="publicationnotesinfoform" method="post" action="../Dispatcher">
    <input type="hidden" name="pagename" value="publicationnotesinfo">
    <input type="hidden" name="actionname">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    
    <input type="hidden" name="transactionid" value="<%=JspHelper.filterNull( notesid )%>">
    <%%>
    <input type="hidden" name="orgid" value="<%=JspHelper.filterNull( userInfo.get("orgid"))%>">
    <input type="hidden" name="notesid" value="<%=JspHelper.filterNull( notesid )%>">
    <input type="hidden" name="status" value="<%=JspHelper.filterNull( status )%>">
	  <input type="hidden" name="grade" value="1">
	  <input type="hidden" name="EAIName" value="*">
	  <input type="hidden" name="subjectcode" value="202">
    <input type="hidden" name="transactioncode" value="<%=JspHelper.filterNull( title )%>"> 
    
    

	<oval:hidden name ="userinfo" property ="userid" scope="session" changedName="fromuserid"/>
   	<input type="hidden" name="begindate" value="<%=JspHelper.filterNull( new java.sql.Date(new java.util.Date().getTime()) )%>">    
<%
  String strLanguageCode0;
  String strLanguageCode1;
  if(strLanguageCode.equalsIgnoreCase("cn"))
  {
	strLanguageCode0 = "cn";
	strLanguageCode1 = "en";
  }else{
	strLanguageCode0 = "en";
	strLanguageCode1 = "cn";    
  }
%>
    <input type="hidden" name="languagecode0" value="<%= strLanguageCode0 %>">
    <input type="hidden" name="languagecode1" value="<%= strLanguageCode1 %>">
    <input type="hidden" name="languagecode2" value="<%= strLanguageCode0 %>">
    <input type="hidden" name="languagecode3" value="<%= strLanguageCode1 %>">
    <input type="hidden" name="entitytype0" value="NT">
    <input type="hidden" name="entitytype1" value="NT">
    <input type="hidden" name="entitytype2" value="NC">
    <input type="hidden" name="entitytype3" value="NC">
    <input type="hidden" name="numrows" value="4">
<input type="hidden" name="content0">
<input type="hidden" name="content1">
<input type="hidden" name="content2">
<input type="hidden" name="content3">



<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr> 
    <td> 
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td colspan="2" class="summary_top"></td>
        </tr>
        <tr> 
          <td colspan="2"><img src="../images/<%= strLanguageCode %>/quote.gif" width="16" height="11">
            <%= label.getLabelName("L_DetailInfo") %><%= label.getLabelName("L_Colon") %></td>
        </tr>
      </table>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr> 
          <td class="td-text" width="81"><%= label.getLabelName("L_Title") %><%= label.getLabelName("L_Colon") %></td>
          <td colspan="3"><%=JspHelper.filterNull(title)%>&nbsp;</td>
        </tr>
          <%--<tr> 
         <td class="td-text"><%= label.getLabelName("L_Picture") %><%= label.getLabelName("L_Colon") %></td>
          <td colspan="3" class="td-listrom"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="3">
              <tr> 
              <%String inet = "";
              try
              {
                InetAddress ia = InetAddress.getLocalHost();
                inet = ia.getHostAddress();
              }
              catch(Exception e)
              {
                e.printStackTrace();
              }
              %>
              <logic:iterate id="ps" collection="<%= pictureinfo %>" indexId="orderId">
					    <%HashMap psMap = (HashMap)ps;
					    if (psMap!=null&&psMap.get("picturename")!=null){
					    %>
					    <td><img src="<%=JspHelper.filterNull( strFileDir )%><%=JspHelper.filterNull( psMap.get("picturename") )%>" border="1"></td>
              <%}%>
              </logic:iterate>
              </tr>
            </table>
          </td>
        </tr>
        --%>
        <tr> 
          <td class="td-text"><%= label.getLabelName("L_Content") %><%= label.getLabelName("L_Colon") %></td>
          <td colspan="3"><%= OvalTools.addBr((String)myhash.get("content")) %>&nbsp;</td>
        </tr>
        <tr>
          <td class="td-text"><%= label.getLabelName("L_IsOpen") %><%= label.getLabelName("L_Colon") %></td>
          <td colspan="3"><%=JspHelper.filterNull( ispublic )%>&nbsp;</td>
        </tr>
        <tr> 
          <td class="td-text"> <%= label.getLabelName("L_Resource") %><%= label.getLabelName("L_Colon") %></td>
          <td width="300"><%=JspHelper.filterNull(fromusername)%>&nbsp;</td>
          <td class="td-text" width=80><%= label.getLabelName("L_SourceOrg") %><%= label.getLabelName("L_Colon") %></td>
          <td><%=JspHelper.filterNull(fromorgshortname)%>&nbsp;</td>
        </tr>
        <tr> 
          <td class="td-text"> <%= label.getLabelName("L_BuildDate") %><%= label.getLabelName("L_Colon") %></td>
          <td ><%=OvalTools.dateToString(begindate,(String)session.getAttribute("dateformat"))%>&nbsp;</td>
          <td class="td-text" width=80><%= label.getLabelName("L_ExpireDate") %><%= label.getLabelName("L_Colon") %></td>
          <td><%=OvalTools.dateToString(enddate,(String)session.getAttribute("dateformat"))%>&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td class="summary_top"></td>
  </tr>
  <%if (userInfo.get("orgid")!=null){%>
  <tr> 
    <td class="td_center">
    <%
    	String strTemp = request.getParameter("pageidname");
    	if ("mynotessummary".equals(strTemp)){
    %>    
      <a onclick="history.go(-1)"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>      
     <%
      }
      else{	
     %>    
      <%
        String backStep = "-1";
        if(request.getParameter("from") != null && request.getParameter("from").equals("maincontent"))
        {
          backStep = "-2";
      %>      
      <a onclick="history.go(<%=JspHelper.filterNull( backStep )%>);"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>
      <%}
      else {%>
      <a onclick="page_back()"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a> 
      <%}%>
      
      <%if (!status.equalsIgnoreCase("")&&Integer.parseInt(status)<11) {%>
      <a onclick="page_done()"><custom:button type="1" label="L_Submit1" imgsrc="submit_batch.gif" border="0" style="width:60"/></a>
      <%}%>
      <%if (!status.equalsIgnoreCase("")&&Integer.parseInt(status)>10&&Integer.parseInt(status)<21) {%>
       <a onclick="page_approval()"><custom:button type="1" label="L_Approve" imgsrc="approve.gif" border="0" style="width:60"/></a>       
<a onclick="page_action('agree')"><custom:button type="1" label="L_Agree" imgsrc="Agree.gif" border="0" style="width:60"/></a>
<a onclick="page_action('deny')"><custom:button type="1" label="L_Deny" imgsrc="no_agree.gif" border="0" style="width:60"/></a>
      <%}%><br>
      </td>
  </tr>
  		<%}
	}%>
</table>
</form>
</body>
</html>


